using Business.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;

namespace Business.Permissions
{
    public class BusinessPermissionDefinitionProvider: PermissionDefinitionProvider
    {

        public override void Define(IPermissionDefinitionContext context)
        {
            var Business = context.AddGroup(BusinessPermissions.Business, L("Business"), MultiTenancySides.Tenant);

            var Book = Business.AddPermission(BusinessPermissions.Book.Default, L("Book"));
            Book.AddChild(BusinessPermissions.Book.Update, L("Edit"));
            Book.AddChild(BusinessPermissions.Book.Delete, L("Delete"));
            Book.AddChild(BusinessPermissions.Book.Create, L("Create"));

            var PrintTemplate = Business.AddPermission(BusinessPermissions.PrintTemplate.Default, L("PrintTemplate"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Update, L("Edit"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Delete, L("Delete"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Create, L("Create"));

            // More code generation...
            var Warehouse = Business.AddPermission(BusinessPermissions.Warehouse.Default, L("Warehouse"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Update, L("Edit"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Delete, L("Delete"));
            Warehouse.AddChild(BusinessPermissions.Warehouse.Create, L("Create"));

            var WarehouseArea = Business.AddPermission(BusinessPermissions.WarehouseArea.Default, L("WarehouseArea"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Update, L("Edit"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Delete, L("Delete"));
            WarehouseArea.AddChild(BusinessPermissions.WarehouseArea.Create, L("Create"));

            var Area = Business.AddPermission(BusinessPermissions.Area.Default, L("Area"));
            Area.AddChild(BusinessPermissions.Area.Update, L("Edit"));
            Area.AddChild(BusinessPermissions.Area.Delete, L("Delete"));
            Area.AddChild(BusinessPermissions.Area.Create, L("Create"));

            var WarehouseLocation = Business.AddPermission(BusinessPermissions.WarehouseLocation.Default, L("WarehouseLocation"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Update, L("Edit"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Delete, L("Delete"));
            WarehouseLocation.AddChild(BusinessPermissions.WarehouseLocation.Create, L("Create"));

            var Inventory = Business.AddPermission(BusinessPermissions.Inventory.Default, L("Inventory"));
            Inventory.AddChild(BusinessPermissions.Inventory.Update, L("Edit"));
            Inventory.AddChild(BusinessPermissions.Inventory.Delete, L("Delete"));
            Inventory.AddChild(BusinessPermissions.Inventory.Create, L("Create"));

            var Inventoryquantity = Business.AddPermission(BusinessPermissions.Inventoryquantity.Default, L("Inventoryquantity"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Update, L("Edit"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Delete, L("Delete"));
            Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Create, L("Create"));

            var Inventorytransit = Business.AddPermission(BusinessPermissions.Inventorytransit.Default, L("Inventorytransit"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Update, L("Edit"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Delete, L("Delete"));
            Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Create, L("Create"));

            var Inventorywarning = Business.AddPermission(BusinessPermissions.Inventorywarning.Default, L("Inventorywarning"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Update, L("Edit"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Delete, L("Delete"));
            Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Create, L("Create"));

            var Inventorystrategy = Business.AddPermission(BusinessPermissions.Inventorystrategy.Default, L("Inventorystrategy"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Update, L("Edit"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Delete, L("Delete"));
            Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Create, L("Create"));

            var Inventoryadjustment = Business.AddPermission(BusinessPermissions.Inventoryadjustment.Default, L("Inventoryadjustment"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Update, L("Edit"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Delete, L("Delete"));
            Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Create, L("Create"));

            //var Inventory = Business.AddPermission(BusinessPermissions.Inventory.Default, L("Inventory"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Update, L("Edit"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Delete, L("Delete"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Create, L("Create"));

            //var Inventoryquantity = Business.AddPermission(BusinessPermissions.Inventoryquantity.Default, L("Inventoryquantity"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Update, L("Edit"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Delete, L("Delete"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Create, L("Create"));

            //var Inventorytransit = Business.AddPermission(BusinessPermissions.Inventorytransit.Default, L("Inventorytransit"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Update, L("Edit"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Delete, L("Delete"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Create, L("Create"));

            //var Inventorywarning = Business.AddPermission(BusinessPermissions.Inventorywarning.Default, L("Inventorywarning"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Update, L("Edit"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Delete, L("Delete"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Create, L("Create"));

            //var Inventorystrategy = Business.AddPermission(BusinessPermissions.Inventorystrategy.Default, L("Inventorystrategy"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Update, L("Edit"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Delete, L("Delete"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Create, L("Create"));

            //var Inventoryadjustment = Business.AddPermission(BusinessPermissions.Inventoryadjustment.Default, L("Inventoryadjustment"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Update, L("Edit"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Delete, L("Delete"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Create, L("Create"));

            //var Inventory = Business.AddPermission(BusinessPermissions.Inventory.Default, L("Inventory"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Update, L("Edit"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Delete, L("Delete"));
            //Inventory.AddChild(BusinessPermissions.Inventory.Create, L("Create"));

            //var Inventoryquantity = Business.AddPermission(BusinessPermissions.Inventoryquantity.Default, L("Inventoryquantity"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Update, L("Edit"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Delete, L("Delete"));
            //Inventoryquantity.AddChild(BusinessPermissions.Inventoryquantity.Create, L("Create"));

            //var Inventorytransit = Business.AddPermission(BusinessPermissions.Inventorytransit.Default, L("Inventorytransit"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Update, L("Edit"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Delete, L("Delete"));
            //Inventorytransit.AddChild(BusinessPermissions.Inventorytransit.Create, L("Create"));

            //var Inventorywarning = Business.AddPermission(BusinessPermissions.Inventorywarning.Default, L("Inventorywarning"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Update, L("Edit"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Delete, L("Delete"));
            //Inventorywarning.AddChild(BusinessPermissions.Inventorywarning.Create, L("Create"));

            //var Inventorystrategy = Business.AddPermission(BusinessPermissions.Inventorystrategy.Default, L("Inventorystrategy"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Update, L("Edit"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Delete, L("Delete"));
            //Inventorystrategy.AddChild(BusinessPermissions.Inventorystrategy.Create, L("Create"));

            //var Inventoryadjustment = Business.AddPermission(BusinessPermissions.Inventoryadjustment.Default, L("Inventoryadjustment"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Update, L("Edit"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Delete, L("Delete"));
            //Inventoryadjustment.AddChild(BusinessPermissions.Inventoryadjustment.Create, L("Create"));

            var OrderLiveWareOUT = Business.AddPermission(BusinessPermissions.OrderLiveWareOUT.Default, L("OrderLiveWareOUT"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Update, L("Edit"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Delete, L("Delete"));
            OrderLiveWareOUT.AddChild(BusinessPermissions.OrderLiveWareOUT.Create, L("Create"));

            var Purchase = Business.AddPermission(BusinessPermissions.Purchase.Default, L("Purchase"));
            Purchase.AddChild(BusinessPermissions.Purchase.Update, L("Edit"));
            Purchase.AddChild(BusinessPermissions.Purchase.Delete, L("Delete"));
            Purchase.AddChild(BusinessPermissions.Purchase.Create, L("Create"));

            var Plan = Business.AddPermission(BusinessPermissions.Plan.Default, L("Plan"));
            Plan.AddChild(BusinessPermissions.Plan.Update, L("Edit"));
            Plan.AddChild(BusinessPermissions.Plan.Delete, L("Delete"));
            Plan.AddChild(BusinessPermissions.Plan.Create, L("Create"));

            var WaitingOutbound = Business.AddPermission(BusinessPermissions.WaitingOutbound.Default, L("WaitingOutbound"));
            WaitingOutbound.AddChild(BusinessPermissions.WaitingOutbound.Update, L("Edit"));
            WaitingOutbound.AddChild(BusinessPermissions.WaitingOutbound.Delete, L("Delete"));
            WaitingOutbound.AddChild(BusinessPermissions.WaitingOutbound.Create, L("Create"));

            //Code generation...



        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<BusinessResource>(name);
        }
    }
}
